package com.ruoyi.web.controller.baodao.task;


import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Component;



/**
 * 定时任务调度测试
 *
 * @author ruoyi
 */
@Component("baodaoTask")
public class BaodaoTask
{

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        System.out.println(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params)
    {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        System.out.println("执行无参方法");
    }


    // 定期保存直播视频
    public void videoRecords()
    {




        Thread nowThread = Thread.currentThread();
        System.out.println("获取当前线程"+nowThread.getName()+","+nowThread.getId());

        // 判断 demo 本地调试 就不录制视频


        try{
            Thread.sleep( 15 * 60 * 1000);
        }
        catch (Exception ex){

        }
        System.out.println("本地调试videoRecords结束");
        return;

        // 15分钟后停止录像 结束进程
        /*ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
        service.schedule(new Runnable() {
            @Override
            public void run() {
                //do something here
                System.out.println("关闭当前线程");
                nowThread.interrupt();
                System.out.println("关闭后当前线程"+nowThread.getName()+","+nowThread.getId());
                System.out.println("结束了吗");
                return;
            }
        }, 15,  TimeUnit.MINUTES);//15后分钟执行一次

        System.out.println("执行保存录像方法");
        liveStartRecord(nowThread);
        // 获取当前线程存入缓存
        System.out.println("结束");*/

    }
}
